//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_IDLE_H__
#define __ELASTOS_IDLE_H__

//
// IdleScheduleClass
//
class IdleScheduleClass : public ScheduleClass
{
public:
    virtual void Initialize();

    virtual void InitializeThread(Thread *pThread);

    virtual void SetThreadPriority(
        Thread *pThread, ThreadPriority priority, bool_t bRunning);
    virtual ThreadPriority GetThreadPriority(Thread *pThread);

    virtual void OnThreadSleep(Thread *pThread);
    virtual void OnThreadWakeUp(Thread *pThread);

    virtual void OnThreadYield(Thread *pThread);

    virtual void OnThreadSwitchOut(Thread *pThread);

    virtual void EnterRunningList(Thread *pThread, RunningReason reason);
    virtual void LeaveRunningList(Thread *pThread);

    virtual void UpdateTime(uint_t uTicks);
    virtual bool_t UpdateThreadTime(Thread *pThread, uint_t uTicks);

    virtual Thread *SelectNextThread();

public:
    IdleScheduleClass();

private:
    uint_t      m_uElapsedTicks;
    DLinkNode   m_listHead;
};

EXTERN IdleScheduleClass g_idleScheduleClass;

#endif // __ELASTOS_IDLE_H__
